package OnlineExam.administrator;

import javax.servlet.http.*;
import org.apache.struts.action.*;
import OnlineExam.db.*;

/**
 *  Deletes a Category from the database.
 */

public final class DeleteCategoryAction extends Action 
{
    
    // The execute() method is where the business logic is provided.
    public ActionForward execute(ActionMapping mapping,ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
	{
		try
		{
			DBUtil.delete ("Category", "CategoryId", request.getParameter("categoryId"));		
			
        	return (mapping.findForward("success"));
		}
		catch (DBException e)
		{
			System.out.println("Exception.." + e);
			return (mapping.findForward("dbError"));
		}
    }
}
